package com.thinksns.sociax.unit;

import android.util.Log;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

/**
 * Created by zhiyi-hehuajun on 2016/11/1.
 */

public class DataUtils {
    private static final String TAG = "DataUtils";

    public static SimpleDateFormat StringData() {
        Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒 EEEE");
        Log.i(TAG, "time1=" + format.format(date));
        format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Log.i(TAG, "time2=" + format.format(date));
        format = new SimpleDateFormat("yyyy/MM/dd");
        Log.i(TAG, "time3=" + format.format(date));
        format = new SimpleDateFormat("HH:mm:ss");
        Log.i(TAG, "time4=" + format.format(date));
        format = new SimpleDateFormat("EEEE");
        Log.i(TAG, "time5=" + format.format(date));
        format = new SimpleDateFormat("E");
        Log.i(TAG, "time6=" + format.format(date));
        return format;
    }

    /**
     * 获取当前年份
     *
     * @return
     */
    public static String getCurrentYear() {
        Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat format = StringData();
        format = new SimpleDateFormat("yyyy");
        return format.format(date);
    }

    /**
     * 获取当前几月
     *
     * @return
     */
    public static String getCurrentMoth() {
        Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat format = StringData();
        format = new SimpleDateFormat("MM");
        return format.format(date);
    }

    /**
     * 获取当前多少号
     *
     * @return
     */
    public static String getCurrentDay() {
        Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat format = StringData();
        format = new SimpleDateFormat("dd");
        return format.format(date);
    }

    /**
     * 获取当前星期几
     *
     * @return
     */
    public static String getCurrentWeekDay() {
        Date date = new Date(System.currentTimeMillis());
        SimpleDateFormat format = StringData();
        format = new SimpleDateFormat("EEEE");
        return format.format(date);
    }
}
